
#include "../include/chat_message_in_memory.h"
#include <iostream>
bool message_list::insert_message_item(const std::string &msg_id, message_item *item)
{
    //后续改成自旋锁
    this->spin_mtx.lock();

    this->message_map[msg_id]=item;

    this->spin_mtx.unlock();


    return true;
}


bool message_list::erase_message_item(const std::string &msg_id)
{
    this->spin_mtx.lock();

    if(this->message_map.count(msg_id)){
        delete message_map[msg_id];
        message_map.erase(msg_id);
    }else{
        std::cout<<"要找的msg_id去delete居然找不到"<<std::endl;
    }
    this->spin_mtx.unlock();
    
    return true;
}
